package easytalk.connectivity.googletalk;

import org.jivesoftware.smack.packet.Presence;

import common.LocatorStatus;
import common.LocatorStatus.LocutorStatusType;

public class GoogleDataAdapter {

	public static LocatorStatus getLocatorStatus(Presence presence) {
		LocatorStatus status = new LocatorStatus();
		if (presence.getStatus() != null)
			status.setAvailability(presence.getStatus());
		switch (presence.getType()) {
		case available:
			switch (presence.getMode()) {
			case available:
			
				status.setType(LocutorStatusType.AVAILABLE);
				break;
			case away:
				status.setType(LocutorStatusType.AWAY);
			case dnd:
			case xa:
				status.setType(LocutorStatusType.DND);
				break;
			case chat:
				status.setType(LocutorStatusType.CHAT);
				
			default:
				break;
			}
			break;

		case unavailable:
			status.setType(LocutorStatusType.UNAVAILABLE);
			break;
			
		case error:
			break;
		case subscribe:
			break;
		case subscribed:
			break;
		case unsubscribe:
			break;
		case unsubscribed:
			break;
		default:
			break;
		}

		return status;

	}
}
